package com.question.service.impl;

import java.util.List;

import com.question.dao.StudentDao;
import com.question.dao.TopicDao;
import com.question.dao.daoFactory.DaoFactory;
import com.question.domain.Student;
import com.question.service.StudentService;
import com.question.service.serviceFactory.ServiceFactory;

public class StudentServiceImpl implements StudentService {
	private StudentDao studentDao = DaoFactory.getInstance().getStudentDao();
	
	@Override
	public Student findUserById(Student studentId) {
		
		return studentDao.findUserById(studentId);
	}

	@Override
	public void insertStu(Student student) {
		studentDao.insertStu(student);;
	}

	@Override
	public int getRank(Student studentId) {
		return studentDao.getRank(studentId);
	}

	@Override
	public void update(Student studentid) {
		studentDao.completeStudent(studentid);
		studentDao.updateRank(studentid, studentDao.getRank(studentid));
	}

	@Override
	public List getRanks() {
		return studentDao.getRanks();
	}
	
	public static void main(String[] args) {
		StudentService studentService = ServiceFactory.getInstance().getStudentService();
		Student stu = new Student();
		stu.setAcademy("软件学院");
		stu.setStudentId(20171818);
		stu.setUserName("贺子龙");
		studentService.insertStu(stu);
		stu.setScoure(87);
		stu.setTime(2311);
		studentService.update(stu);
	}

}
